﻿using System.Collections.Generic;

namespace S7PlcDataCollector.Service.SQLiteProxy.Bll
{
    internal class S7PlcEntity
    {
        private readonly Dal.S7PlcEntity _dal = new Dal.S7PlcEntity();

        /// <summary>
        /// 添加PLC实体
        /// </summary>
        /// <param name="model">PLC实体对象</param>
        /// <returns>Rid</returns>
        public int Add(Models.S7PlcEntity model)
        {
            return _dal.Insert(model);
        }

        /// <summary>
        /// 批量添加PLC实体
        /// </summary>
        /// <param name="models">PLC实体对象集合</param>
        /// <returns>true成功，false失败</returns>
        public bool Add(List<Models.S7PlcEntity> models)
        {
            return _dal.Insert(models);
        }

        /// <summary>
        /// 更新PLC实体
        /// </summary>
        /// <param name="model">PLC实体对象</param>
        /// <returns>true成功，false失败</returns>
        public bool Update(Models.S7PlcEntity model)
        {
            return _dal.Update(model);
        }

        /// <summary>
        /// 删除PLC实体
        /// </summary>
        /// <param name="model">PLC实体对象</param>
        /// <returns>true成功，false失败</returns>
        public bool Delete(Models.S7PlcEntity model)
        {
            return _dal.Delete(model);
        }

        /// <summary>
        /// 查询PLC实体
        /// </summary>
        /// <param name="rid">PLC实体id</param>
        /// <returns>PLC实体对象</returns>
        public Models.S7PlcEntity GetModel(int rid)
        {
            return _dal.GetModel(rid);
        }

        /// <summary>
        /// 查询所有PLC实体
        /// </summary>
        /// <returns>PLC实体对象集合</returns>
        public List<Models.S7PlcEntity> GetAllModels()
        {
            return _dal.GetAllModels();
        }
    }
}
